﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OA.Model
{
    public class MenuInfo
    {
        /// <summary>
        /// parentName
        /// </summary>
        public string p { get; set; }

        /// <summary>
        /// Name
        /// </summary>
        public string n { get; set; }

        /// <summary>
        /// Code
        /// </summary>
        public string c { get; set; }

        /// <summary>
        /// Area
        /// </summary>
        public string a { get; set; }

        /// <summary>
        /// Control
        /// </summary>
        public string ct { get; set; }

        /// <summary>
        /// Action
        /// </summary>
        public string at { get; set; }

        /// <summary>
        /// ClassName
        /// </summary>
        public string cn { get; set; }


        /// <summary>
        /// IsMenu
        /// </summary>
        public bool m { get; set; }

        /// <summary>
        /// IsSelected
        /// </summary>
        public bool s { get; set; } = false;
    }

    public class MenuInfoComparer : IEqualityComparer<MenuInfo>
    {
        public bool Equals(MenuInfo x, MenuInfo y)
        {
            return x.c.CompareTo(y.c) == 0;
        }

        public int GetHashCode(MenuInfo obj)
        {
            return obj.c.GetHashCode();
        }
    }

}
